<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" th:src="@{/js/jquery-1.12.4.js}"></script>
</head>
<style>
    #sendBtn{
        float:left;

        min-width:20%;
    }
    *{
        margin: 0px;
        padding: 0px;
        box-sizing: border-box;
    }
    .rg_layout{
        width: 900px;
        height: 500px;
        border: 5px solid #EEEEEE;
        /*让div水平居中*/
        margin: auto;
        margin-top: 15px;
        background:#ff6678;
        filter:alpha(opacity=80);
        -moz-opacity:0.8;
        -khtml-opacity: 0.8;
        opacity: 0.8;
    }
    .rg_left{
        float: left;
        margin: 15px;
        width: 20%;
    }
    .rg_left > p:first-child{
        color: #FFD026;
        font-size: 20px;
    }
    .rg_left > p:last-child{
        color: #A6A6A6;
    }
    .rg_center{
        /*border: 1px solid red;*/
        float: left;
        width: 450px;
        /*margin: 15px;*/
    }
    .rg_right{
        float: right;
        margin: 15px;
    }
    .rg_right > p:first-child{
        font-size: 15px;
    }
    .rg_right p a {
        color: pink;
    }
    .td_left{
        width: 100px;
        text-align: right;
        height: 45px;
    }
    .td_right{
        padding-left: 50px;
    }
    #wuser,#wemail,#wphone,#yzm,#wpassword{
        width: 251px;
        height: 32px;
        border: 1px solid #A6A6A6;
        /*设置边框圆角*/
        border-radius: 5px;
        padding-left: 10px ;
    }
    span{
        width: 150px;
    }
    #btn_sub{
        width: 380px;
        height: 40px;
        background-color: #FFD026;
        border: 1px solid #FFD026;
    }
</style>
<body>
<div class="rg_layout">
    <div class="rg_left">
        <p>企业注册</p>
        <p>ENTERPRISE REGISTER</p>
    </div>
    <div class="rg_center">
        <form>
            <table>
                <tr>
                    <td class="td_left">企业账号</td>
                    <td><input class="td_right" type="text" name="cuser" id="cuser" placeholder="请输入您的名称"></td>
                    <td><span  class="yongh"></span></td>
                </tr>
                <tr>
                    <td class="td_left">密码</td>
                    <td><input class="td_right" type="password" name="cpassword" id="cpassword" placeholder="请输入您的密码"></td>
                    <td> <span class="mima"></span></td>
                </tr>
            </table>
            <input colspan="2"  type="button" id="btn_sub"  onclick="pan()" value="注册">
        </form>
    </div>
    <div class="rg_right">
        <p>已有账号?<a href="/CodeFarmersSpeedPost/workuser/index">立即登录</a></p>
    </div>
</div>
<script>
    function pan() {

        var cuser = $("#cuser").val();

        var cpassword = $("#cpassword").val();


        var boolea = true;

        if (cuser == '') {
            $(".yongh").html("企业账号不能为空");
            boolea = false;
        } else {
            $(".yongh").html("")
        }
        if (cpassword == '') {
            $(".mima").html("密码不能为空")
            boolea = false;
        } else {
            $(".mima").html("");
        }
        if (boolea == true) {

            $.ajax({
                type: 'GET',
                url: '/CodeFarmersSpeedPost/companyuser/add',
                data: {
                    cuser: cuser,
                    cpassword: cpassword
                },
                dataType: "json",
                success: function (data) {
                    if (data.flag) {
                        alert(data.msg);
                        window.location.href = "index";
                    } else {
                        alert(data.msg);
                        window.location.href = "qiyeLogin";
                    }
                }

            });
        }
    };
</script>
</body>
</html>